import { TextComponentProps } from "./defaultProps";

export interface PropToForm {
  component: string;
  subComponent?: string;
  value?: string;
  extraProps?: {[key: string]: any};
  text?: string;
  options?: {text: string, value: any}[];
}

export type PropsToForms = {
  [P in keyof TextComponentProps]?: PropToForm;
};

export const mapPropsToForms: PropsToForms = {
  text: {
    text: '文本',
    component: "a-textarea",
    extraProps: {
      rows: 3
    }
  },
  fontSize: {
    text: '字体大小',
    component: 'a-input-number',
  },
  lineHeight: {
    text: '行高',
    component: 'a-slider',
    extraProps: {
      min: 0,
      max: 3,
      step: 0.1,
    }
  },
  textAlign: {
    component: 'a-radio-group',
    text: '对齐方式',
    subComponent: 'a-radio-button',
    options: [
      { text: '左对齐', value: 'left' },
      { text: '居中对齐', value: 'center' },
      { text: '右对齐', value: 'right' },
    ],
  },
  fontFamily: {
    text: '字体',
    component: 'a-select',
    subComponent: 'a-select-option',
    options: [
      { text: '宋体', value: 'SimSun' },
      { text: '黑体', value: 'SimHei' },
      { text: '微软雅黑', value: 'Microsoft YaHei' },
      { text: '楷体', value: 'KaiTi' },
      { text: '仿宋', value: 'FangSong' },
      { text: '隶书', value: 'LiSu' },
    ],
  }
};
